import 'package:deer/res/colors.dart';
import 'package:deer/res/styles.dart';
import 'package:deer/util/utils.dart';
import 'package:deer/widgets/highlight_well.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class SelectTextItem extends StatelessWidget {
  const SelectTextItem(
      {Key key,
      this.onTap,
      @required this.title,
      this.content: '',
      this.textAlign: TextAlign.start,
      this.style})
      : super(key: key);

  final GestureTapCallback onTap;
  final String title;
  final String content;
  final TextAlign textAlign;
  final TextStyle style;

  @override
  Widget build(BuildContext context) {
    return HighLightWell(
      onTap: onTap,
      child: Container(
        height: 50,
        width: double.infinity,
        margin: const EdgeInsets.only(left: 16, right: 16),
        decoration: BoxDecoration(
            border: Border(
              bottom: Divider.createBorderSide(context,
                  color: Colours.line, width: 0.6),
            )),
        child: Row(
          children: <Widget>[
            Text(
              title ?? '',
              style: TextStyles.textDark14,
            ),
            Expanded(
              flex: 1,
              child: Padding(
                padding: const EdgeInsets.only(left: 16, right: 8),
                child: Text(
                  content ?? '',
                  maxLines: 2,
                  textAlign: textAlign,
                  overflow: TextOverflow.ellipsis,
                  style: style ?? TextStyles.textDark14,
                ),
              ),
            ),
            Image.asset(
              Utils.getImagePath('ic_arrow_right'),
              width: 16,
              height: 16,
            ),
          ],
        ),
      ),
    );
  }
}
